import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '姓名',
    align:"center",
    dataIndex: 'name'
  },
  {
    title: '证件类型',
    align:"center",
    dataIndex: 'paperType_dictText'
  },
  {
    title: '证件号码',
    align:"center",
    dataIndex: 'paperNumber'
  },
  {
    title: '手机号码',
    align:"center",
    dataIndex: 'phone'
  },
  {
    title: '头像',
    align:"center",
    dataIndex: 'photobw',
    slots: { customRender: 'img' },
  },
/*   {
    title: '人员id',
    align:"center",
    dataIndex: 'bwId'
   },*/
   {
    title: '现场照片',
    align:"center",
    dataIndex: 'photo'
   },
   {
    title: '预警时间',
    align:"center",
    sorter: true,
    dataIndex: 'alarmTime'
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: "姓名",
    field: 'name',
    component: 'JInput',
    //colProps: {span: 6},
  },
  {
    label: '证件类型',
    field: 'paperType',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode:"paperType",
      stringToNumber:true,
    },
  },


  {
    label: "证件号码",
    field: 'paperNumber',
    component: 'Input',
    //colProps: {span: 6},
  },
     {
      label: "预警时间",
      field: "alarmTime",
      component: 'RangePicker',
      componentProps: {
          valueType: 'Date',
          //showTime:true
      },
      //colProps: {span: 6},
	},
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '人员id',
    field: 'bwId',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入人员id!'},
          ];
     },
  },
  {
    label: '现场照片',
    field: 'photo',
    component: 'Input',
  },
  {
    label: '预警时间',
    field: 'alarmTime',
    component: 'DatePicker',
    componentProps: {
       showTime: true,
       valueFormat: 'YYYY-MM-DD HH:mm:ss'
     },
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入预警时间!'},
          ];
     },
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];

// 高级查询数据
export const superQuerySchema = {
  bwId: {title: '人员id',order: 0,view: 'text', type: 'string',},
  photo: {title: '现场照片',order: 1,view: 'text', type: 'string',},
  alarmTime: {title: '预警时间',order: 2,view: 'datetime', type: 'string',},
};

/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}
